// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.ast.*;
// import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
// import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

// import java.util.ArrayList;
// import java.util.List;
#pragma once
#include "../SQLStatementImpl.h"
#include "SQLDDLStatement.h"
#include "SQLAlterStatement.h"

class SQLAlterTableStatement
    : virtual public SQLStatementImpl,
      virtual public SQLDDLStatement,
      virtual public SQLAlterStatement
{
public:
  SQLExprTableSource_ptr tableSource;
  SQLAlterTableItem_list_ptr items;

  // for mysql
  BOOL_ptr ignore;
  BOOL_ptr online;
  BOOL_ptr offline;

  BOOL_ptr updateGlobalIndexes;
  BOOL_ptr invalidateGlobalIndexes;

  BOOL_ptr removePatiting;
  BOOL_ptr upgradePatiting;
  SQLAssignItem_list_ptr tableOptions;
  SQLPartitionBy_ptr partition;

  // odps
  BOOL_ptr mergeSmallFiles;
  BOOL_ptr range;
  SQLSelectOrderByItem_list_ptr clusteredBy;
  SQLSelectOrderByItem_list_ptr sortedBy;
  int buckets;
  int shards;

  BOOL_ptr ifExists;
  BOOL_ptr notClustered;

  // clickhouse
  SQLName_ptr on;

  SQLAlterTableStatement();

  SQLAlterTableStatement(DbType_ptr dbType);
  SHAREDOBJECT(SQLAlterTableStatement);

  BOOL_ptr isIgnore();

  void setIgnore(BOOL_ptr ignore);

  BOOL_ptr isOnline();

  void setOnline(BOOL_ptr online);

  BOOL_ptr isOffline();

  void setOffline(BOOL_ptr offline);

  BOOL_ptr isIfExists();

  void setIfExists(BOOL_ptr ifExists);

  BOOL_ptr isRemovePatiting();

  void setRemovePatiting(BOOL_ptr removePatiting);

  BOOL_ptr isUpgradePatiting();

  void setUpgradePatiting(BOOL_ptr upgradePatiting);

  BOOL_ptr isUpdateGlobalIndexes();

  void setUpdateGlobalIndexes(BOOL_ptr updateGlobalIndexes);

  BOOL_ptr isInvalidateGlobalIndexes();

  void setInvalidateGlobalIndexes(BOOL_ptr invalidateGlobalIndexes);

  BOOL_ptr isMergeSmallFiles();

  void setMergeSmallFiles(BOOL_ptr mergeSmallFiles);

  SQLAlterTableItem_list_ptr getItems();

  void addItem(SQLAlterTableItem_ptr item);

  SQLExprTableSource_ptr getTableSource();

  void setTableSource(SQLExprTableSource_ptr tableSource);

  void setTableSource(SQLExpr_ptr table);

  SQLName_ptr getName();

  long nameHashCode64();

  void setName(SQLName_ptr name);

  SQLAssignItem_list_ptr getTableOptions();

  SQLPartitionBy_ptr getPartition();

  void setPartition(SQLPartitionBy_ptr partition);

  // @Override
  void accept0(SQLASTVisitor_ptr visitor);

  // @Override
  SQLObject_list_ptr getChildren();

  string_ptr getTableName();

  string_ptr getSchema();

  void setItems(SQLAlterTableItem_list_ptr items);

  BOOL_ptr isRange();

  void setRange(BOOL_ptr range);

  SQLSelectOrderByItem_list_ptr getClusteredBy();

  void addClusteredByItem(SQLSelectOrderByItem_ptr item);

  SQLSelectOrderByItem_list_ptr getSortedBy();

  void addSortedByItem(SQLSelectOrderByItem_ptr item);

  int getBuckets();

  void setBuckets(int buckets);

  int getShards();

  void setShards(int shards);

  BOOL_ptr isNotClustered();

  void setNotClustered(BOOL_ptr notClustered);

  // @Override
  SQLDDLStatement::DDLObjectType getDDLObjectType();

  SQLName_ptr getOn();

  void setOn(SQLName_ptr x);
};
